package com.zhiyume.controller;

import com.zhiyume.dao.entity.TAdminSys;
import com.zhiyume.dto.BaseResponse;
import com.zhiyume.service.ModifyPasswdService;
import com.zhiyume.shiro.AdminSecurityManager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author jiaxz
 * @date 2017/12/10 14:34
 * @description
 */
@RestController
public class ModifyPassWdController {
    @Autowired
    private ModifyPasswdService modifyPasswdService;
    @RequestMapping("/user/modifyPassword")
    public int modifyPassWd(@RequestParam(defaultValue = "") String oldPassword,@RequestParam(defaultValue = "") String password) {
        TAdminSys sysUser = AdminSecurityManager.getSessionTAdminSys();
        BaseResponse baseResponse = new BaseResponse();
        if(null == sysUser) {
            baseResponse.setErrType("fail");
        }
        long uid = sysUser.getId();
       return modifyPasswdService.modifyPasswd(sysUser.getId(),oldPassword,password);

    }
}
